package myapp

class LoginController {

	def index() {

	}

	def login() {
		def myTest = new MyTest()
		myTest.test()
		
		if (request.get) {
			return
		}
		
		if (params.username == "admin" && params.password == "admin") {
			session.user = params.username
			redirect(uri: "/")
		} else {
			render(view: "login", model: [error: "User or Password incorrect", "username": params.username])
		}
	}
	
	def logout() {
		session.user = null
		render(view: "login")
	}
}
